//
//  YJDLabel.m
//  sigleAPP
//
//  Created by SKL on 2017/11/22.
//  Copyright © 2017年 SKL. All rights reserved.
//

@implementation YJDLabel
- (instancetype)init
{
    self = [super init];
    if (self)
    {
        self.textColor = [YJDHelper shareHelp].color;
        self.textAlignment = NSTextAlignmentCenter;
    }
    return self;
}

- (instancetype)initWithText:(NSString *)text
{
    self = [self init];
    if (self) {
        self.text = text;
    }
    return self;
}

- (instancetype)initWithTextColor:(UIColor *)textColor font:(UIFont *)font
{
    self = [super init];
    if (self)
    {
        self.textColor = textColor;
        self.font = font;
    }
    return  self;
}

- (void)setText:(NSString *)text{
    [super setText:text];
    [self sizeToFit];
    [self mas_updateConstraints:^(SK_MASConstraintMaker *make) {
        make.size.mas_equalTo(self.bounds.size);
    }];
}

- (void)setAttributedText:(NSAttributedString *)attributedText
{
    [super setAttributedText:attributedText];
    [self sizeToFit];
    [self mas_updateConstraints:^(SK_MASConstraintMaker *make) {
        make.size.mas_equalTo(self.bounds.size);
    }];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
